package com.fire.control.system.module.duty.controller.app;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.fire.control.system.dto.UserDTO;
import com.fire.control.system.dto.app.AppDutySignVo;
import com.fire.control.system.module.common.controller.BaseController;
import com.fire.control.system.module.duty.service.IDutyService;
import com.fire.control.system.standard.BusinessInterfaceStandard;
import com.fire.control.system.support.protocol.comman.ResponseProtocol;
import com.fire.control.system.support.protocol.duty.DutyRequestProtocol;
import com.fire.control.system.support.protocol.duty.LeaveDutyRequestProtocol;
import com.fire.control.system.support.protocol.duty.SignRequestProtocol;

/**
 * @author liuxincheng
 * @ClassName: SignControl
 * @Description: TODO(值班控制器)
 * @date 2017年6月1日 下午2:35:46
 */
@RestController
@RequestMapping("/app/DutyCtr")
public class AppDutyControl extends BaseController implements BusinessInterfaceStandard<DutyRequestProtocol, ResponseProtocol> {

	@Autowired
	private IDutyService dutyService;
	
	/**
	 * @author  liuxincheng
	 * @Title: junmpToSignPage
	 * @Description: TODO(跳转到签到页面,获取经纬度)
	 * @param @param requestProtocol
	 * @param @return    设定文件
	 * @return ResponseProtocol    返回类型
	 * @throws null
	 */
	
	@RequestMapping(value="/jumpToSignPage",method=RequestMethod.POST)
	public ResponseProtocol junmpToSignPage(@RequestBody SignRequestProtocol requestProtocol){
		ResponseProtocol response = dutyService.jumpToSignPage(requestProtocol,this.getUser());
		return response;
	}
	
	/**
	 * @author liuxincheng
	 * @Title: signDataFetch
	 * @Description: TODO(确认签到)
	 * @param @param appDutySignVo
	 * @param @return    设定文件
	 * @return ResponseProtocol    返回类型
	 * @throws
	 */
	@RequestMapping(path="/confirmSign",method=RequestMethod.POST)
	public ResponseProtocol confirmSign(@RequestBody SignRequestProtocol requestProtocol){
		ResponseProtocol response = dutyService.confirmSign(requestProtocol,this.getUser());
		return response;
	}
	
	/**
	 * @author  liuxincheng
	 * @Title: signDataFetch
	 * @Description: TODO(确认签到 并 数据刷新)
	 * @param @param requestProtocol
	 * @param @return    设定文件
	 * @return ResponseProtocol    返回类型
	 * @throws null
	 */
	@RequestMapping(path="/signDataFetch",method=RequestMethod.POST)
	public ResponseProtocol signDataFetch(@RequestBody SignRequestProtocol requestProtocol){
		ResponseProtocol response = dutyService.signDataFetch(requestProtocol,this.getUser());
		return response;
	}
	
	/**
	 * @author  liuxincheng
	 * @Title: patchSignIn
	 * @Description: TODO(补签到)
	 * @param @param requestProtocol
	 * @param @return    设定文件
	 * @return ResponseProtocol    返回类型
	 * @throws null
	 */
	@RequestMapping(path="/patchSignIn",method=RequestMethod.POST)
	public ResponseProtocol patchSignIn (@RequestBody SignRequestProtocol requestProtocol){
		ResponseProtocol response = dutyService.patchSignIn(requestProtocol,this.getUser());
		return response;
	}
	
	
	/**
	 * @author liuxincheng
	 * @Title: workRecord
	 * @Description: TODO(我的工作记录)
	 * @param @param requestProtocol
	 * @param @return    设定文件
	 * @return ResponseProtocol    返回类型
	 * @throws null
	 */
	@RequestMapping(path="/workRecord",method=RequestMethod.POST)
	public ResponseProtocol workRecord(@RequestBody SignRequestProtocol requestProtocol){
		ResponseProtocol response = dutyService.workRecord(requestProtocol,this.getUser());
		return response;
	}
	
	/**
	 * @author  liuxincheng
	 * @Title: dutySheet
	 * @Description: TODO(我的值班表)
	 * @param @param requestProtocol
	 * @param @return    设定文件
	 * @return ResponseProtocol    返回类型
	 * @throws null
	 */
	@RequestMapping(path="/dutySheet",method=RequestMethod.POST)
	public ResponseProtocol dutySheet(@RequestBody SignRequestProtocol requestProtocol){
		ResponseProtocol response = dutyService.dutySheet(requestProtocol,this.getUser());
		return response;
	}
	
	/**
	 * @author  liuxincheng
	 * @Title: signInList
	 * @Description: TODO(签到列表)
	 * @param @param requestProtocol
	 * @param @return    设定文件
	 * @return ResponseProtocol    返回类型
	 * @throws null
	 */
	@RequestMapping(path="/signInList",method=RequestMethod.POST)
	public ResponseProtocol signInList(@RequestBody DutyRequestProtocol requestProtocol,@RequestBody Pageable p){
		ResponseProtocol response = dutyService.signInList(requestProtocol,p);
		return response;
	}
	/**
	 * 
	* @Title: addDutyLeave 
	* @Description: TODO(添加请假) 
	* @param @param leaveDutyRequestProtocol
	* @param @return    设定文件 
	* @return ResponseProtocol    返回类型 
	* @throws
	 */
	@RequestMapping(path="/addDutyLeave",method=RequestMethod.POST)
	public ResponseProtocol addDutyLeave(@RequestBody LeaveDutyRequestProtocol  leaveDutyRequestProtocol){
		return dutyService.addDutyLeave(leaveDutyRequestProtocol,this.getUser());
	}
}
